home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / Macros / ReadErr.aed < prev   
Text File  |  1995-01-25  |  2KB  |  61 lines

  1. /* ReadErr.aed -- mark errors in an Oberon module */
  2.  
  3. /* trace all */
  4. options results
  5.  
  6. if ~show('L','rexxsupport.library') then
  7.    call addlib('rexxsupport.library',0,-30)
  8.  
  9. /* Extract the module name and generate the error file name */
  10.  
  11. 'top first'
  12. 'find ODULE' ; 'wright'
  13. 'scanf %[~;]'
  14. 'getval $scanf'
  15. module = result
  16. errFile = module || '.err'
  17.  
  18. /* Open the error file and skip the header */
  19.  
  20. if open('err', errFile, 'R') then do
  21.   /* Check first to see if it is a binary error file */
  22.   if readch('err', 4) = 'OAER' then do
  23.     /* Close the error file and call OEL instead */
  24.     close('err')
  25.     address command 'OBERON-A:OEL >t:ErrMsgs NOANSI COLWIDTH=70 ERRPATH=Code' module
  26.     'newwindow newfile t:ErrMsgs'
  27.   end
  28.   else do
  29.     /* Could be a text error file, try to parse it */
  30.     seek('err', 0, 'B')
  31.  
  32.     /* Skip the header lines */
  33.     do i = 1 to 4
  34.       line = readln('err')
  35.       if eof('err') then do
  36.         say ' !! Error in' errFile
  37.         exit
  38.       end
  39.     end
  40.  
  41.     /* We should now be positioned to read the error lines */
  42.     do i = 1
  43.       /* Read a line, parse it and store it in a stem variable */
  44.       line = readln('err')
  45.       if eof('err') then leave
  46.       parse var line 'line' errs.i.l ', col' errs.i.c ': err =' errs.i.e .
  47.     end
  48.  
  49.     /* Now insert the error reports in the source file */
  50.     do j = (i - 1) to 1 by -1
  51.       'noscrupdate goto ' || errs.j.l || ' gotocol ' || errs.j.c
  52.       'noscrupdate down insline (\^-- err: ' || errs.j.e || ')'
  53.     end
  54.   end
  55. end
  56. else do
  57.   say ' !! Could not open' errFile
  58.   exit
  59. end
  60.  
  61.